//
//  Utils.h
//  customer
//
//  Created by 安徽威思特 on 16/6/14.
//  Copyright © 2016年 tiaohuo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#ifndef Utils_h
#define Utils_h






//弱引用
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;



//适配用
#define IPHONE4S (([[UIScreen mainScreen] bounds].size.width == 320) && ([[UIScreen mainScreen] bounds].size.height == 480))

#define IPHONE5S (([[UIScreen mainScreen] bounds].size.width == 320) && ([[UIScreen mainScreen] bounds].size.height == 568))

#define IPHONE6 (([[UIScreen mainScreen] bounds].size.width == 375) && ([[UIScreen mainScreen] bounds].size.height == 667))

#define IPHONE6P (([[UIScreen mainScreen] bounds].size.width == 414) && ([[UIScreen mainScreen] bounds].size.height == 736))


#define Label(x,y,with,height)  [[UILabel alloc]initWithFrame:CGRectMake(x, y, with, height)]
#define View(x,y,with,height)  [[UIView alloc]initWithFrame:CGRectMake(x, y, with, height)]
#define String(Str) [NSString stringWithFormat:@"%@",Str]



//宏定义简单的ALERT用法
#define ALERT(msg)    if (![[UIApplication sharedApplication].delegate window].rootViewController.presentedViewController) {UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];UIAlertAction * Sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {}];[alert addAction:Sure];[[[UIApplication sharedApplication].delegate window].rootViewController presentViewController:alert animated:YES completion:nil];}

//宏定义颜色
#define RGB(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]


//屏幕宽度
#define WIDTH  [UIScreen mainScreen].bounds.size.width
//屏幕高度
#define HEIGHT  [UIScreen mainScreen].bounds.size.height

#define SCALX WIDTH/375
#define SCALY HEIGHT/667

#endif /* Utils_h */

/**
 *  会话状态
 */
typedef NS_ENUM(NSUInteger,SESSIONSTATE) {
    /**
     *  会话成功
     */
    SESSIONSUCCESS,
    /**
     *  会话无效
     */
    SESSIONINVALID,
    /**
     *  会话错误
     */
    SESSIONERROR,
    /**
     *  未知异常
     */
    SESSIONNONE,
};


@interface Utils : NSObject

+ (NSDictionary*) getData:(NSDictionary *)responDic;

+(void)phone:(NSString *)mobile controller:(UIViewController *)controller;

+ (void)setUserToken:(NSString *)userToken;
+ (NSString *)getUserToken;

+ (void)SetSearchArr:(NSMutableArray *)SearchArr;
+ (NSMutableArray *)getSearchArr;

+ (void)setJWD:(NSString *)j and:(NSString *)w;
+ (NSString *)getJWD;

+(BOOL) synchronizeToDisk;

+(NSString *)getImaSting:(NSString *)str;

//创建统一的searchBar
+ (UISearchBar *)createSearchBar:(CGFloat)x and:(CGFloat)y and:(CGFloat)width;
@end
